//
//  HomePageHeaderView.swift
//  MikerShop
//
//  Created by eme on 2016/12/6.
//  Copyright © 2016年 eme. All rights reserved.
//

import UIKit
import RxSwift

class HomePageHeaderView: UICollectionReusableView {

    @IBOutlet weak var title_Lb: UILabel!
    @IBOutlet weak var cotent_V: UIView!
    
    @IBOutlet weak var contentBg_ImgV: UIImageView!
    var item:IndexModel?{
        didSet{
            if let item = item {
                self.title_Lb.text = item.title
                let placeholderImg = item.headerheight > 130 ? "banner-placeholder" : "homepage-header-placeholder"
                self.contentBg_ImgV.setUrlImage(item.headerimagekey,placeholderImage: placeholderImg)
            }
        }
    }
    var didSelected_Closure:((_ item:IndexModel) -> Void)?
    override func awakeFromNib() {
        let tapGesture = UITapGestureRecognizer(target: self, action: #selector(HomePageHeaderView.tapClick))
        self.cotent_V.addGestureRecognizer(tapGesture)
    }
    func tapClick() -> Void {
        if let closure = self.didSelected_Closure {
            closure(self.item!)
        }
    }
}
